package com.back.supplier.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.back.supplier.bean.Tbl_goodsType;
import com.back.supplier.bean.Tbl_supplier;
import com.back.supplier.service.GoodsTypeService;
import com.back.supplier.service.SupplierService;

@Controller
public class GoodsTypeAction {

	@Autowired
	private GoodsTypeService service;
	@Autowired
	private SupplierService supplierService;
	
	@RequestMapping("/findGoodsTypes")
	public String findGoodsTypes(Tbl_goodsType goodsType,HttpServletRequest request){
		System.out.println(goodsType);
		Tbl_supplier supplier=new Tbl_supplier();
		List<Tbl_supplier> allsupplier = supplierService.findSupplier(supplier);
		System.out.println(allsupplier);
		request.getSession().setAttribute("allsupplier", allsupplier);
		List<Tbl_goodsType> goodsTypeList = service.findGoodsTypes(goodsType);
		System.out.println(goodsTypeList);
		request.getSession().setAttribute("goodsTypeList", goodsTypeList);
		return "redirect:/jsps/goodstype/list.jsp";
	}
	@RequestMapping("/addGoodsType")
	public String addGoodsType(Tbl_goodsType goodsType){
		System.out.println(goodsType);
		service.addGoodsType(goodsType);
		return "redirect:/findGoodsTypes.action";
	}
	@RequestMapping("/findGoodsTypeById")
	public String findGoodsTypeById(Integer uuid){
		
	}
	
}
